
import org.apache.commons.beanutils.PropertyUtils;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;

@Service
public class RmsDischargeConfigServiceImpl implements RmsDischargeConfigService  {

    @Resource
    private RmsDischargeConfigMapper rmsDischargeConfigMapper;

    /**
     * 获取 RmsDischargeConfig 分页列表
     */
    @Transactional
    public IPage getRmsDischargeConfigPagination( PaginationVo paginationVo, RmsDischargeConfigQuery rmsDischargeConfigQuery ) throws Exception {

        IPage page = new Page( paginationVo.getPageIndex(), paginationVo.getPageSize() );
        LambdaQueryWrapper<RmsDischargeConfigEntity> lqs = new LambdaQueryWrapper();
        rmsDischargeConfigMapper.selectPage(page, lqs);

        List<RmsDischargeConfigEntity> record = page.getRecords();
        if( !ObjectUtil.isNotEmptyList(record)){
            return page;
        }
        return null;
    }


    /**
     * 获取 RmsDischargeConfig 所有数据
     *
    */
    @Transactional
    public List<RmsDischargeConfigEntity> getRmsDischargeConfigAllList( RmsDischargeConfigQuery rmsDischargeConfigQuery ) throws Exception {

        LambdaQueryWrapper<RmsDischargeConfigEntity> lqs = new LambdaQueryWrapper();
        List<RmsDischargeConfigEntity> list = rmsDischargeConfigMapper.selectList(lqs);
        return list;
    }


    /**
     * 获取 RmsDischargeConfig 详情
    */
    @Transactional
    public RmsDischargeConfigEntity getRmsDischargeConfigDetail( Long id) throws Exception {

        RmsDischargeConfigEntity rmsDischargeConfig = rmsDischargeConfigMapper.selectById(id);
        return rmsDischargeConfig;
    }


    /**
     * 新增 RmsDischargeConfig
     * */
    @Transactional
    public void addRmsDischargeConfig(RmsDischargeConfigVo rmsDischargeConfigVo) throws Exception {

        RmsDischargeConfigEntity rmsDischargeConfig = new RmsDischargeConfigEntity();
        ReflectionCopy.copyProperties( rmsDischargeConfig, rmsDischargeConfigVo );
        rmsDischargeConfigMapper.insert(rmsDischargeConfig);
        return;
    }


    /**
     * 更新 RmsDischargeConfig
     * */
    @Transactional
    public void updateRmsDischargeConfig( RmsDischargeConfigVo rmsDischargeConfigVo) throws Exception {

        if( rmsDischargeConfigVo.getId() == null ){
            throw GlobalException.gen(10021, "id不存在");
        }
        RmsDischargeConfigEntity rmsDischargeConfig = new RmsDischargeConfigEntity();
        ReflectionCopy.copyProperties( rmsDischargeConfig, rmsDischargeConfigVo );
        rmsDischargeConfigMapper.updateById(rmsDischargeConfig);
        return;
    }

    /**
     * 删除 RmsDischargeConfig
     * */
    @Transactional
    public void batchRemoveRmsDischargeConfig( List<Long> ids ) throws Exception {


        if( !ObjectUtil.isNotEmptyList(ids) ){
            throw GlobalException.gen(10011, "要删除的id不存在");
        }
        rmsDischargeConfigMapper.deleteBatchIds(ids);
    }

}

      